Create a folder

Hello,

 


bu12 - Wed Jan 14 08:52:46 EST 2015

Re: Create a folder
Mike.Scharnow - Wed Jan 14 09:06:50 EST 2015

That depends on which part of the DXL reference manual is unclear to you.

("The name argument can be an absolute or relative name, and may include the path")

In addition to absolute name, see: setting current Project, setting current Folder

Re: Create a folder
llandale - Wed Jan 14 17:41:29 EST 2015

I think it best to get these 3 pieces of information:

  1. The name of the parent folder in which you want the new folder.  Looks like "/MyProject/MyFolder"
  2. The base name of the folder to be created.  Looks like "MyNewFolder"
  3. The description of this folder.  Looks like "This Folder houses new stuff"

If you get a handle on the parent folder you can

  1. Verify it really exists
  2. Verify there is no sub-folder with the desired name already
  3. Verify you have "C"reate rights to that folder and otherwise can create in it.

You can put the two paths together to create a fullName of the desire folder: /MyProject/MyFolder/MyNewFolder"

A common use for a "Relative" folder would be to create a specific folder in the current Project, whatever that is.

  1. Set the current Project as the current Folder: current Folder = folder(fullName(current Project))
  2. Create the new folder using just its base name

-Louie

 

Re: Create a folder
bu12 - Fri Jan 16 02:30:04 EST 2015

Mike.Scharnow - Wed Jan 14 09:06:50 EST 2015

That depends on which part of the DXL reference manual is unclear to you.

("The name argument can be an absolute or relative name, and may include the path")

In addition to absolute name, see: setting current Project, setting current Folder

Thank you.

 

 I want to copy a module from one folder to another.

What can I do?

Re: Create a folder
Mike.Scharnow - Sun Jan 18 07:04:27 EST 2015

To answer such questions, always ask yourself: how would you do it without DXL?  DXL is like a shortcut for all the clicks and keystrokes you would normally do "manually".

In this case, the answer might be "I could use the clipboard, so I click on the folder, use Copy, I navigate to the destination Folder, use Paste."

Then you go to the DXL manual and search for copy and paste. You will find the section "Hierarchy clipboard" which explains how the clipboard works and find the functions clipCopy and clipPase.

If your answer is "it is not sufficient to the clipboard, because the destination folder needs a different folder name / module name / module content / access rights", you have to define your exact requirements, design your program and find the DXL functions you need...

Hope this helps,

Mike

 

Re: Create a folder
Mike.Scharnow - Mon Jan 19 06:40:55 EST 2015

Hi bu12,

in it's barest form, this code is correct.

There are some things to take into account, though:

  • both, clipCopy and clipPaste return string values. You should store the result of the command in a string variable and check, whether the result is null or not. if it is not null, the string is an error message, which you could e.g. show to the user. It seems you already thought about this when declaring the strings result and result2.
  • if you play around with copy / paste for a while and read the error messages, you will notice that DOORS wants to set a "lock" on the item to be copied. This is only possible when the source project is the current project. So, let's say you have a source project "/Templates" and this project contains folders like "Req Template Folder" and "Test Template Folder". Then the user should only enter the string "Req Template Folder" into the DBE target_template and your code would say e.g.
Project pSource = project "/Templates"
current = pSource
string sResult = clipCopy (tg)
if (!null sResult) {...; return}

 

  • to get the item to be copied, you used "item (fullName (folder (<inputstring>)))". You could also have used "item (<inputstring>)". But by using the intermediate variable thisFolder, you have one more possibility for error checking. So, after initializing thisFolder, you could make a test whether thisFolder really refers to a folder (by checking it for not null), which gives you another possibility to present an error message to your user.
  • Then of course there are possibilities to improve your gui. If this topic is especially about choosing a template for a new folder, you could populate a list box and allow the user only to choose from e predefined set of template folders

Hope this helps,
Mike

Re: Create a folder
Mike.Scharnow - Mon Jan 19 06:46:51 EST 2015

Mike.Scharnow - Mon Jan 19 06:40:55 EST 2015

Hi bu12,

in it's barest form, this code is correct.

There are some things to take into account, though:

  • both, clipCopy and clipPaste return string values. You should store the result of the command in a string variable and check, whether the result is null or not. if it is not null, the string is an error message, which you could e.g. show to the user. It seems you already thought about this when declaring the strings result and result2.
  • if you play around with copy / paste for a while and read the error messages, you will notice that DOORS wants to set a "lock" on the item to be copied. This is only possible when the source project is the current project. So, let's say you have a source project "/Templates" and this project contains folders like "Req Template Folder" and "Test Template Folder". Then the user should only enter the string "Req Template Folder" into the DBE target_template and your code would say e.g.
Project pSource = project "/Templates"
current = pSource
string sResult = clipCopy (tg)
if (!null sResult) {...; return}

 

  • to get the item to be copied, you used "item (fullName (folder (<inputstring>)))". You could also have used "item (<inputstring>)". But by using the intermediate variable thisFolder, you have one more possibility for error checking. So, after initializing thisFolder, you could make a test whether thisFolder really refers to a folder (by checking it for not null), which gives you another possibility to present an error message to your user.
  • Then of course there are possibilities to improve your gui. If this topic is especially about choosing a template for a new folder, you could populate a list box and allow the user only to choose from e predefined set of template folders

Hope this helps,
Mike

Oh, sorry - I just noticed that Louis already pointed out some things on my list and added more things to take care of. Read through his post again and incorporate his hints into your code.

BR,
Mike 

Re: Create a folder
bu12 - Thu Jan 22 02:38:14 EST 2015

Mike.Scharnow - Mon Jan 19 06:46:51 EST 2015

Oh, sorry - I just noticed that Louis already pointed out some things on my list and added more things to take care of. Read through his post again and incorporate his hints into your code.

BR,
Mike 

Hello,

I can copy now the modules from one folder to another. If I look at the modul features and then Linksets, I can´t see the Linkmodul and the Status.

 

Re: Create a folder
Mike.Scharnow - Thu Jan 22 05:24:54 EST 2015

bu12 - Thu Jan 22 02:38:14 EST 2015

Hello,

I can copy now the modules from one folder to another. If I look at the modul features and then Linksets, I can´t see the Linkmodul and the Status.

 

Hi!

This might be an access problem. Link restrictions (in DXL Link Module Descriptors) and the status is stored in the folder where the source module is stored and you need to have "A" rights on this folder

Do you have "A"dmin access rights on the destination folder?

In other words: what happens if you copy/paste the folder manually, without DXL. Is the link restriction information copied?

 

Edit: ... is stored ... where the source (formal, not link) module is stored...

Re: Create a folder
bu12 - Mon Jan 26 02:52:27 EST 2015

Mike.Scharnow - Thu Jan 22 05:24:54 EST 2015

Hi!

This might be an access problem. Link restrictions (in DXL Link Module Descriptors) and the status is stored in the folder where the source module is stored and you need to have "A" rights on this folder

Do you have "A"dmin access rights on the destination folder?

In other words: what happens if you copy/paste the folder manually, without DXL. Is the link restriction information copied?

 

Edit: ... is stored ... where the source (formal, not link) module is stored...

Hi,

 

if I copy/paste the folder manually it works, the link restriction information was copied.

Re: Create a folder
Mike.Scharnow - Mon Jan 26 03:55:22 EST 2015

bu12 - Mon Jan 26 02:52:27 EST 2015

Hi,

 

if I copy/paste the folder manually it works, the link restriction information was copied.

Hi,

in the other thread you stated that you use DOORS 9.6, so the bug that was mentioned by BillTidy should not be the root case.

I use 9.6.0.0 (64 bit) and cannot reproduce the problem. Let me summarize the problem how I understand it and the prerequisites:

  • a (source) folder contains a folder F1 which contains formal module. This formal module contains link restrictions for the out links
  • The folder F1 can be copied without any problem mentioned in the result string of the clipCopy command
  • The current folder is then set to the destination folder / project
  • The currently logged in user (the user who starts the script) has "A" rights on the destination folder
  • The script can paste F1 into the destination folder without any problem mentioned in the result string of the clipPaste command
  • A new folder F1 is created, a copy of the formal module is created, everything is OK except for the link restrictions
  • If the same logged in user copies the same folder F1 without DXL and pastes into the same destination folder without DXL, the link restrictions are copied.

If all this is true, I'm sorry, I do not have another idea. Perhaps some of the others here have, or the IBM help desk.

BR,
Mike